﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Yipusoft.Account.BLL;
using Yipusoft.Account.Model;
using Yipusoft.Common.BLL;
using Yipusoft.Common.Model;
using Yipusoft.Task.BLL;
using Yipusoft.Task.Model;
using System.IO;

public partial class Task_DeleteFile : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["Flag"] == null)
        {
            TaskFileInfo file = TaskFile.GetTaskFile(int.Parse(Request.QueryString["FileId"]));

            File.Delete(Server.MapPath("\\upload") + file.FileName);
            TaskFile.Delete(int.Parse(Request.QueryString["FileId"]));
            Response.Redirect("EditView.aspx?RootId=" + Request.QueryString["RootId"]);
        }
        else
        {
            TaskLogFileInfo file = TaskLogFile.GetTaskLogFile(int.Parse(Request.QueryString["FileId"]));

            File.Delete(Server.MapPath("\\upload") + file.FileName);
            TaskLogFile.Delete(int.Parse(Request.QueryString["FileId"]));
            Response.Redirect("UserView.aspx?RootId=" + Request.QueryString["RootId"]+"&UserId="+Request.QueryString["UserId"]);
        }
    }
}
